package refactoring.replaceSubclassWithDelegate.refactoring;

/**
 * <描述>
 *
 * @author timothy.yang cloudwise
 * @since 2022-05-23 23:09
 */
public class NorwegianBlueParrotDelegate extends BirdDelegate {
    private final Integer voltage;
    private final Boolean isNailed;

    public NorwegianBlueParrotDelegate(BirdParam birdParam, Bird bird) {
        super(birdParam, bird);
        this.voltage = birdParam.getVoltage();
        this.isNailed = birdParam.isNailed();
    }

    @Override
    public String getPlumage() {
        if (this.voltage > 100) {
            return "scorched";
        } else {
            return this.bird.plumage() != null ? this.bird.plumage() : "beautiful";
        }
    }

    @Override
    public Integer airSpeedVelocity() {
        return this.isNailed ? 0 : 10 + this.voltage / 10;
    }
}
